package com.example.q_kang.hhh.login;

import com.example.q_kang.hhh.api.JsonCallBack;
import com.lzy.okgo.model.Response;
import com.lzy.okgo.request.base.Request;
import com.sskj.base.BasePresenter;
import com.example.q_kang.hhh.login.AgreementActivity;
import com.sskj.base.api.Constant;
import com.sskj.base.base.HttpData;
import com.sskj.base.bean.AgreementBean;


/**
 * @author Hey
 * Create at  2019/04/17
 */
class AgreementPresenter extends BasePresenter<AgreementActivity> {

    public void getAgreement() {
        httpService.getAgreement()
                .tag(this)
                .execute(new JsonCallBack<HttpData<AgreementBean>>() {
                    @Override
                    public void onSuccess(Response<HttpData<AgreementBean>> response) {
                        HttpData<AgreementBean> body = response.body();
                        if (body.getStatus() == Constant.OK) {
                            mView.showAgreement(body.getData());
                        }
                    }

                    @Override
                    public void onStart(Request<HttpData<AgreementBean>, ? extends Request> request) {
                        super.onStart(request);
                        mView.showLoading();
                    }

                    @Override
                    public void onFinish() {
                        super.onFinish();
                        mView.hideLoading();
                    }
                });
    }
}
